//引入用来发送请求的方法
import {} from "../../request/index.js";
wx -
  Page({
    /**
     * 页面的初始数据
     */
    data: {
      //轮播图数组
      imgUrls: [
        "/image/4.png",
        "/image/1.jpeg",
        "/image/2.jpeg",
        "/image/3.jpeg",
      ],
      circular: true,
      //是否显示画板指示点
      indicatorDots: true,
      //选中点的颜色
      //是否竖直
      vertical: false,
      //是否自动切换
      autoplay: true,
      //自动切换的间隔
      interval: 3000,
      //滑动动画时长毫秒
      duration: 1000,
      //所有图片的高度
      imgheights: [],
      //图片宽度
      imgwidth: 750,
      //默认
      current: 0,
      //导航数组
      catesList: [
        {
          name: "电脑维修",
          image: "/image/ComputerRepair.png",
          navigator_url: "../../components/ComputerRepair/ComputerRepair",
        },
        {
          name: "手机维修",
          image: "/image/CellphoneRepair.png",
          navigator_url: "../../components/ComputerRepair/ComputerRepair",
        },
        {
          name: "软件下载",
          image: "/image/SD.png",
          navigator_url: "../../components/ComputerRepair/ComputerRepair",
        },
      ],
      catesListTwo: [
        { image: "/image/DataRestoration.png" },
        { image: "/image/TeachingVideo.png" },
        { image: "/image/JoinUs.png" },
      ],
    },

    /**
     * 生命周期函数--监听页面加载
     * 页面开始加载 就会触发
     */
    imageonLoad: function (e) {
      //获取图片真实宽度
      var imgwidth = e.detail.width,
        imgheight = e.detail.height,
        //宽高比
        ratio = imgwidth / imgheight;
      console.log(imgwidth, imgheight);
      //计算的高度值
      var viewHeight = 750 / ratio;
      var imgheight = viewHeight;
      var imgheights = this.data.imgheights;
      //把每一张图片的对应的高度记录到数组里
      imgheights[e.target.dataset.id] = imgheight;
      this.setData({
        imgheights: imgheights,
      });
    },
    bindchange: function (e) {
      // console.log(e.detail.current)
      this.setData({ current: e.detail.current });
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {},

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {},

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {},

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {},

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {},

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {},

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {},
    onPageScroll: function () {},
    //item(index,pagePath,text)
    onTabItemTap: function (item) {},
  });
